<?php


namespace App\Http\Controllers;

use App\Models\Cart;
use App\Models\LampUser;
use App\Models\Order;
use Illuminate\Http\Request;
use Spatie\RouteAttributes\Attributes\Prefix;
use Spatie\RouteAttributes\Attributes\Any;

#[Prefix('table-suffix')]
class TableSuffixController extends  Controller
{
    /**
     * scope 使用多个条件包含orwhere 会将这个作用域使用括号包起来
     */
    #[Any('/')]
    #[Get('/index')]
    public function index(Request $request)
    {
        Cart::setTableIdentification(9527);
       // Order::setTableIdentification(9528);
        $data[] = (new Cart())->getTable();
        $data[] = (new Order())->getTable();
        return $data;
    }

    #[Any('hasBook')]
    public function hasBook()
    {
        //$data = LampUser::query()->with('book')->first();
        $data = LampUser::query()->wherehasin('book')->first();
        //$data = $data->toJson();
        //$data  = response($data);
        //$data  = response($data)->content();
        $data  = response($data)->getContent();
        $data  = response($data)->getContent();
        //var_dump($data);
        return '123';
        //return response($data)->content();
    }

}
